package hqu.cst.xah.onlinemaill.controller;

import hqu.cst.xah.onlinemaill.pojo.Product;
import hqu.cst.xah.onlinemaill.service.ProductService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/product")
@Tag(name = "产品管理", description = "产品管理相关接口")
public class ProductController {
    @Autowired
    private ProductService productService;

    @GetMapping("/getAllProducts")
    public List<Product> getAllProducts() {
        return productService.getAllProducts();
    }

    @GetMapping("/getProductById")
    public Product getProductById(Integer id) {
        return productService.getProductById(id);
    }
}
